import 'package:flutter/material.dart';

class Homenav extends StatefulWidget {
  const Homenav({super.key});

  @override
  State<Homenav> createState() => _HomenavState();
}

class _HomenavState extends State<Homenav> {
  List _navList = [
    {'title': '我的房屋', 'icon': 'assets/images/house_nav_icon@2x.png'},
    {'title': '我的保修', 'icon': 'assets/images/repair_nav_icon@2x.png'},
    {'title': '访客登记', 'icon': 'assets/images/visitor_nav_icon@2x.png'},
  ];
  List<Widget> getNavList() {
    return _navList.map((item) {
      return Expanded(
        child: Column(
          children: [
            Image.asset(
              item["icon"],
              width: 35,
            ),
            Text(
              item['title'],
              style: const TextStyle(fontSize: 15, color: Colors.black),
            )
          ],
        ),
      );
    }).toList();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(10), color: Colors.white),
      padding: const EdgeInsets.fromLTRB(20, 10, 20, 10),
      child: Row(
        children: getNavList(),
      ),
    );
  }
}
